//===--- Mirrors.swift.gyb - Common _Mirror implementations ---*- swift -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

%{

from SwiftIntTypes import all_integer_types

# Number of bits in the Builtin.Word type
word_bits = int(CMAKE_SIZEOF_VOID_P) * 8

Types = [
    ('Float', '.float', 'self'),
    ('Double', '.double', 'self'),
    ('Bool', '.bool', 'self'),
    ('String', '.text', 'self'),
    ('Character', '.text', 'String(self)'),
    ('Unicode.Scalar', '.uInt', 'UInt64(self)'),
]

for self_ty in all_integer_types(word_bits):
  Self = self_ty.stdlib_name
  if self_ty.is_signed:
    Types.append( (Self, '.int', 'Int64(self)') )
  else:
    Types.append( (Self, '.uInt', 'UInt64(self)') )

}%

%for Type in Types:

extension ${Type[0]}: CustomReflectable {
  /// A mirror that reflects the `${Type[0]}` instance.
  public var customMirror: Mirror {
    return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
  }
}

extension ${Type[0]}: _CustomPlaygroundQuickLookable {
  /// A custom playground Quick Look for the `${Type[0]}` instance.
  @available(*, deprecated, message: "${Type[0]}.customPlaygroundQuickLook will be removed in a future Swift version")
  public var customPlaygroundQuickLook: _PlaygroundQuickLook {
    return ${Type[1]}(${Type[2]})
  }
}
% end

#if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
extension Float80: CustomReflectable {
  /// A mirror that reflects the Float80 instance.
  public var customMirror: Mirror {
    return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
  }
}
#endif

// ${'Local Variables'}:
// eval: (read-only-mode 1)
// End:
